$("#membershipOther").click(function () {
    if ($("#membersNum").val() == "" || $("#membersNum").val() == undefined || $("#membersNum").val() == null) {
        alert("请输入会员卡号！");
        return false;
    }
    if ($("#phone").val() == "" || $("#phone").val() == undefined || $("#phone").val() == null) {
        alert("请输入会员手机号码！");
        return false;
    }
    $.ajax({
        url: Feng.ctxPath + "/integralMallWeixin/getMembershipCard",
        type: "POST",
        data: {
            "membersNum": $("#membersNum").val(),
            "phone": $("#phone").val()
        },
        success: function (data) {
            if (data != null && data != "null" && data != "" && data != "undefined") {
                var member = window.parent.$("#discountDiscount").val();
                window.parent.document.getElementById("reservationsIdx").value=data.reservationsId;
                var discountDiscount = parseFloat(data.discountDiscount / 10).toFixed(2);
                if (confirm("当前查询会员等级为" + data.vipLevelName + "，折扣为" + data.discountDiscount + "折，是否使用？")) {
                    window.parent.membership(discountDiscount);
                    window.parent.$("#moneyBalance").html(data.moneyBalancex);
                    window.parent.$("#jfbalance").html(data.scoreBalancex);
                    $("#membershipOther", parent.document).prop('checked', true);
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                } else {
                    window.parent.membership(member);
                    $("#membershipOther", parent.document).prop('checked', false);
                    $("#membershipOther", parent.document).data('waschecked', false);
                }
            } else {
                alert("手机号或卡号输入错误，请重新输入");
                $("#membershipOther", parent.document).prop('checked', false);
            }
        },
        error: function (data) {
            alert('权限被限制，请联系管理员!');
        }
    });
});

$("#cancelDiscount").click(function () {
    var member = window.parent.$("#discountDiscount").val();
    window.parent.membership(member);
    $("#membershipOther", parent.document).prop('checked', false);
    $("#membershipOther", parent.document).data('waschecked', false);
    parent.layer.close(parent.layer.getFrameIndex(window.name));
});